#include<iostream>
#include<climits>
using namespace std;
const int N=1e6+10;
const int M=2e3+10;
int a[N];
int b[M];
int main()
{
	int n,m;cin>>n>>m;
	int ret=INT_MAX;
	int mleft=-1,mright=-1;
	for(int i=1;i<=n;i++) cin>>a[i];
	int left=1,right=1,k=0;
	while(right<=n)
	{
		if(b[a[right]]++==0)
		{
			k++;
		}
		
		while(k>=m)
		{
			if(ret>right-left+1)
			{
				ret=right-left+1;
				mright=right;
				mleft=left;
			}
			if(--b[a[left]]==0)
			{
				k--;
			}
			left++;
		}
		right++;
	}
	cout<<mleft<<" "<<mright<<endl;
}